home *** CD-ROM | disk | FTP | other *** search
/ Stolen Data 2 / Stolen Data 2.adf / Source / Sine_bars.s < prev    next >
Text File  |  1989-11-02  |  6KB  |  201 lines

  1. *****************************************************************************
  2. ;   Raster routine - simple raster bar move routine using the blitter,
  3. ;           - taken from the STOLEN DATA intro
  4.  
  5. ;  Copyright - Kreator of ANARCHY
  6. *****************************************************************************
  7.  
  8.     Incdir    DF1:
  9.     Include    Source/CustomRegisters    ; Contains custom reg. equates
  10.     Section    Base,Code_c        ; Ensure it assembles into chip mem.
  11.  
  12. Trap_vec0    = $80
  13. Execbase    = $4
  14. Oldopen        = -$198
  15.  
  16.     Movem.l    d0-d7/a0-a6,-(a7)
  17.     Move.l    #Start,Trap_vec0
  18.     Trap    #0        ; Jump into "Start" routine in Supervisor mode
  19.     Movem.l    (a7)+,d0-d7/a0-a6
  20.     Rts
  21.  
  22. Start
  23.     Bsr    Killsys
  24.     Bsr    Setup
  25.     Bsr    Main
  26.     Bsr    Sysreturn
  27.     Rte            ;Executed with a TRAP instr. (Exception)
  28.  
  29. *****************************************************************************
  30. ;Killsys - Disable operating system and interrupts
  31. *****************************************************************************
  32. Killsys    Move    Intenar,Int_set    ; Remember interrupt status
  33.     Move    #$7fff,Intena
  34.     Move.l    $6c.w,Vbl_vec    ; Store Vbalnk interrupt vector
  35.     Move    Dmaconr,Dma_set
  36.     Move    #$7fff,Dmacon
  37.     Move    #$87cf,Dmacon    ; Set the DMA enable status
  38.     Move.l    Execbase,a6
  39.     Lea    Gfxname(pc),a1
  40.     Jsr    Oldopen(a6)
  41.     Move.l    d0,a5
  42.     Move.l    38(a5),Sys_copl    ; Save the system copperlist
  43.     Move.l    #Clstart,Cop1lch    ; Start our own copperlist
  44.     Clr    Copjmp1
  45.     Rts
  46.  
  47. Int_set        Dc.w 0
  48. Dma_set        Dc.w 0
  49. Sys_copl    Dc.l 0
  50. Vbl_vec        Dc.l 0
  51. Gfxname        Dc.b "graphics.library",0
  52.     Even
  53. *****************************************************************************
  54. ;Sysreturn - Re-enable operating system and interrupts
  55. *****************************************************************************
  56. Sysreturn
  57.     Move    #$7fff,Intena
  58.     Move.l    Vbl_vec(pc),$6c.w    ; Restore the Vblank int. vector
  59.     Move    Int_set(pc),d0
  60.     Or    #$c000,d0
  61.     Move    d0,Intena    ; Start up interrupts again
  62.     Move    #$7fff,Dmacon
  63.     Move    Dma_set(pc),d0
  64.     Or    #$8200,d0
  65.     Move    d0,Dmacon    ; Restore DMA status
  66.     Move.l    Sys_copl,Cop1lch
  67.     Clr    Copjmp1        ; Restore the system copperlist
  68.     Rts
  69. *****************************************************************************
  70. ; Main - Central demo calling routine + mouse button check
  71. *****************************************************************************
  72. Main
  73.     Move.l    $dff004,d0
  74.     And.l    #$1ff00,d0
  75.     Cmp.l    #$01000,d0    ; Wait for vert. pos. 16
  76.     Bne.s    Main
  77.  
  78.     Bsr    Rasters
  79.  
  80.     Btst    #6,$bfe001    ; Check left mouse button
  81.     Bne.s    Main
  82.     Rts
  83.  
  84. *****************************************************************************
  85. ; Setup routine
  86. *****************************************************************************
  87. Setup
  88.     ;    No routines to setup really
  89.     Rts
  90.  
  91. *****************************************************************************
  92. ; Raster effects
  93. *****************************************************************************
  94. Rasters
  95.     Lea    Logo_bars+6(pc),a0    ; Clear the old rasters
  96.     Move.l    #-1,Bltafwm
  97.     Move.l    #$00000006,Bltamod
  98.     Move.l    #$1f00000,Bltcon0
  99.     Clr    Bltadat
  100.     Move.l    a0,Bltdpth
  101.     Move    #136*64+1,Bltsize
  102. Clr_wait
  103.     Btst    #14,Dmaconr        ; Wait for the blitter to finish
  104.     Bne.s    Clr_wait
  105.  
  106.     Lea    Sintable(pc),a1
  107.     Add.b    #2,Bar_pt+1
  108.     Move    Bar_pt(pc),d0        ; Get the new sine pointer
  109.  
  110.     Move.l    #$9f00000,Bltcon0    ; Set the blitter ready for
  111.     Move.l    #Bar_cols,Bltapth    ; blitting the raster bars into
  112.     Move    #37,d1            ; the copperlist (38 of them)
  113.     Moveq    #0,d2
  114. Rast_loop
  115.     Move.b    (a1,d0),d2
  116.     Lsl    #2,d2
  117.     And    #$3f8,d2        ; Each line of the copperlist is
  118.                     ; 8 bytes apart
  119.     Lea    (a0,d2),a2
  120.     Move.l    a2,Bltdpth
  121.     Move    #64*8+1,Bltsize        ; Each bar is 8 lines deep
  122.     Addq.b    #6,d0        
  123. Blitit
  124.     Btst    #14,Dmaconr
  125.     Bne.s    Blitit
  126.     Dbf    d1,Rast_loop
  127.     Rts
  128.  
  129. *****************************************************************************
  130. ; Variables
  131. *****************************************************************************
  132.  
  133. Bar_pt        Dc.w 0
  134.  
  135. *****************************************************************************
  136. ; Copperlists
  137. *****************************************************************************
  138. Clstart
  139.     Mov    $1a64,Diwstrt
  140.     Mov    $39d1,Diwstop
  141.     Mov    $0030,Ddfstrt
  142.     Mov    $00d8,Ddfstop
  143.     Mov    0,Bplcon0
  144.  
  145. Logo_bars
  146. A set 0
  147.     Rept    136
  148.     Wait    222,(90+A)&$ff
  149.     Mov    0,Color00
  150. A set A+1
  151.     Endr
  152.  
  153.     Wait    $fe,$ff
  154.  
  155. *****************************************************************************
  156. ; Binaries
  157. *****************************************************************************
  158. Sintable
  159.     Incbin    Binary/Sin1    ;256 byte long sintable
  160.  
  161. Bar_cols
  162.     Dc.w    $600,$900,$c00,$f00,$f00,$c00,$900,$600
  163.     Dc.w    $601,$903,$c04,$f06,$f06,$c04,$903,$601
  164.     Dc.w    $603,$905,$c08,$f0b,$f0b,$c08,$905,$603
  165.     Dc.w    $606,$909,$c0c,$f0f,$f0f,$c0c,$909,$606
  166.     Dc.w    $306,$509,$80c,$b0f,$b0f,$80c,$509,$306
  167.     Dc.w    $106,$309,$50c,$60f,$60f,$50c,$309,$106
  168.     Dc.w    $006,$009,$00c,$00f,$00f,$00c,$009,$006
  169.     Dc.w    $016,$039,$05c,$06f,$06f,$05c,$039,$016
  170.     Dc.w    $036,$059,$08c,$0bf,$0bf,$08c,$059,$036
  171.     Dc.w    $066,$099,$0cc,$0ff,$0ff,$0cc,$099,$066
  172.     Dc.w    $063,$095,$0c8,$0fb,$0fb,$0c8,$095,$063
  173.     Dc.w    $061,$093,$0c5,$0f6,$0f6,$0c5,$093,$061
  174.     Dc.w    $060,$090,$0c0,$0f0,$0f0,$0c0,$090,$060
  175.     Dc.w    $160,$390,$5c0,$6f0,$6f0,$5c0,$390,$160
  176.     Dc.w    $360,$590,$8c0,$bf0,$bf0,$8c0,$590,$360
  177.     Dc.w    $660,$990,$cc0,$ff0,$ff0,$cc0,$990,$660
  178.     Dc.w    $630,$950,$c80,$fb0,$fb0,$c80,$950,$630
  179.     Dc.w    $610,$930,$c50,$f60,$f60,$c50,$930,$610
  180.     Dc.w    $600,$900,$c00,$f00,$f00,$c00,$900,$600
  181.     Dc.w    $600,$900,$c00,$f00,$f00,$c00,$900,$600
  182.     Dc.w    $601,$903,$c04,$f06,$f06,$c04,$903,$601
  183.     Dc.w    $603,$905,$c08,$f0b,$f0b,$c08,$905,$603
  184.     Dc.w    $606,$909,$c0c,$f0f,$f0f,$c0c,$909,$606
  185.     Dc.w    $306,$509,$80c,$b0f,$b0f,$80c,$509,$306
  186.     Dc.w    $106,$309,$50c,$60f,$60f,$50c,$309,$106
  187.     Dc.w    $006,$009,$00c,$00f,$00f,$00c,$009,$006
  188.     Dc.w    $016,$039,$05c,$06f,$06f,$05c,$039,$016
  189.     Dc.w    $036,$059,$08c,$0bf,$0bf,$08c,$059,$036
  190.     Dc.w    $066,$099,$0cc,$0ff,$0ff,$0cc,$099,$066
  191.     Dc.w    $063,$095,$0c8,$0fb,$0fb,$0c8,$095,$063
  192.     Dc.w    $061,$093,$0c5,$0f6,$0f6,$0c5,$093,$061
  193.     Dc.w    $060,$090,$0c0,$0f0,$0f0,$0c0,$090,$060
  194.     Dc.w    $160,$390,$5c0,$6f0,$6f0,$5c0,$390,$160
  195.     Dc.w    $360,$590,$8c0,$bf0,$bf0,$8c0,$590,$360
  196.     Dc.w    $660,$990,$cc0,$ff0,$ff0,$cc0,$990,$660
  197.     Dc.w    $630,$950,$c80,$fb0,$fb0,$c80,$950,$630
  198.     Dc.w    $610,$930,$c50,$f60,$f60,$c50,$930,$610
  199.     Dc.w    $600,$900,$c00,$f00,$f00,$c00,$900,$600
  200.  
  201.